<?php
namespace App\Common\Lib\Com\GoWeakReferencePool;

use App\Common as com;
use App\Common\Lib\Com\GoWeakReferencePool\Traits as thisTraits;

trait Traits {

	/**
	 * @var com\Lib\Com\WeakReferencePool
	 */
	private com\Lib\Com\WeakReferencePool $_goWeakReferencePool;

	/**
	 * @var com\Lib\Com\WeakReferencePoolOrObj
	 */
	private com\Lib\Com\WeakReferencePoolOrObj $_goWeakReferencePoolOrObj;

	/**
	 * 弱引用池
	 * 注意：与 goWeakReferencePoolOrObj 的区别为本方法会将所有对象自动转为弱引用)
	 * @return com\Lib\Com\WeakReferencePool
	 * @throws
	 */
	public function goWeakReferencePool(  ):com\Lib\Com\WeakReferencePool {
		if( ! isset( $this->_goWeakReferencePool ) ){
			$this->_goWeakReferencePool = com\Lib\Com\WeakReferencePool::make();
		}
		//
		return $this->_goWeakReferencePool;
	}

	/**
	 * 弱引用池
	 * 注意：与 goWeakReferencePool 的区别为本方法为支持弱引用和对象存储池)
	 * @return com\Lib\Com\WeakReferencePoolOrObj
	 * @throws
	 */
	public function goWeakReferencePoolOrObj(  ):com\Lib\Com\WeakReferencePoolOrObj {
		if( ! isset( $this->_goWeakReferencePoolOrObj ) ){
			$this->_goWeakReferencePoolOrObj = com\Lib\Com\WeakReferencePoolOrObj::make();
		}
		//
		return $this->_goWeakReferencePoolOrObj;
	}

}
